import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

const pathResolve = (dir) => {
  return resolve(__dirname, ".", dir)
}

export default defineConfig(({ mode, command }) =>{
  const env = loadEnv(mode, process.cwd());
  return {
    base: env.VITE_APP_CONTEXT_PATH,
    plugins: [vue()],
    server: {
      port: 5173,
      host: true,
    },
    resolve: {
      alias: [
        {
          find: "@",
          replacement: pathResolve("src")
        }
      ]
    }
  }
})
